//
//  HELMaterialCell.m
//  HandheldELearn
//
//  Created by 陈武琦 on 16/7/12.
//  Copyright © 2016年 陈武琦. All rights reserved.
//

#import "HELMaterialCell.h"
#import "UIImageView+WebCache.h"
#import "NSString+Utilities.h"
#import "UIImageView+BTimageView.h"
@implementation HELMaterialCell




- (void)setModel:(HELExamModel *)model {
    _model = model;
    self.title.text = model.title;
    [self.leftImageView nc_setImageWithUrl:model.titlePageUrl];
   
    self.beginTime.text = [NSString stringWithFormat:@"开始时间: %@",[NSString timeToString:[model.beginOpenTime longLongValue]]];
    
    self.examTimes.text = [NSString stringWithFormat:@"考试次数: %@/%@",model.useExamCount?model.useExamCount:@"0",model.totalcount?model.totalcount:@"0"];
    
    self.scoreL.hidden = YES;
    self.scoreL_titile.hidden = YES;
    self.examStatus.backgroundColor = [UIColor colorWithWhite:.3 alpha:.6];
    
    
    
    if (model.passStatus) {
    
        switch ([model.passStatus integerValue]) {
            case 0:
                self.examStatus.text  =@"未开始";
                self.examStatus.backgroundColor =[UIColor colorWithRed:51/255.0 green:48/255.0 blue:48/255.0 alpha:.7];
                break;
            case 1:
                self.examStatus.text  =@"已通过";
                self.examStatus.backgroundColor = [UIColor colorWithRed:242/255.0 green:101.0/255.0 blue:119.0/255.0 alpha:.8];
                break;
            case 2:
                self.examStatus.text  =@"未通过";
                self.examStatus.backgroundColor = [UIColor colorWithRed:51/255.0 green:48/255.0 blue:48/255.0 alpha:.7];;
                break;
                
            default:
                break;
        }
        
      
    }else{
        
    }
//    }else{
//        switch ([model.computeType integerValue]) {
//            case 0:
//                self.examStatus.text = @"未开始";
//                break;
//            case 1:
//                self.examStatus.text = @"进行中";
//                self.examStatus.backgroundColor = [UIColor colorWithRed:242/255.0 green:101.0/255.0 blue:119.0/255.0 alpha:.8];
//                break;
//            case 2:
//                self.examStatus.text = @"已过期";
//                
//                break;
//                
//            default:
//                break;
//        }
//        
//
//    }
//    
    
    
}



- (void)setRecord_model:(HELExameRecordModel *)record_model{
    //id

    //score

    //createTime
  
    //title

    //type
 
    self.title.text = record_model.title;
    [self.leftImageView nc_setImageWithUrl:record_model.titlePageUrl]; 
    self.beginTime.text = [NSString stringWithFormat:@"开始时间: %@", [NSString timeToString:[record_model.createTime longLongValue]]];
    self.scoreL.hidden = NO;
    self.scoreL_titile.hidden = NO;
 
    
    self.examTimes.text = @"考试得分   ";
    self.scoreL.text = [NSString stringWithFormat:@"%@",record_model.score];
    if (record_model.type) {
      
        switch ([record_model.type integerValue]) {
          
            case 1:
                self.examStatus.text  =@"已通过";
                self.examStatus.backgroundColor = [UIColor colorWithRed:242/255.0 green:101.0/255.0 blue:119.0/255.0 alpha:.8];
                break;
            case 2:
                self.examStatus.text  =@"未通过";
                self.examStatus.backgroundColor = [UIColor colorWithRed:51/255.0 green:48/255.0 blue:48/255.0 alpha:.7];;
                break;
                
            default:
                break;
        }
    }

}




//- (void)setRecord_model:(HELStatisticModel *)model{
//
//    self.title.text = model.title;
//    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:model.coverUrlShow] placeholderImage:[UIImage imageNamed:@"暂无图片.jpg"]];
//    
//    self.beginTime.text = [NSString stringWithFormat:@"开始时间: %@",model.beginExamTimeShow];
//    
//    self.examTimes.text = [NSString stringWithFormat:@"满分: %@分",model.fullScore?model.fullScore:@"   "];
// 
//    
//    self.scoreL.text = [NSString stringWithFormat:@"%@分",model.examScore];
//  
//    self.examStatus.backgroundColor = [UIColor colorWithWhite:.3 alpha:.6];
//    self.examStatus.text = model.examStatusShow;
//
//    if ([model.examStatusShow isEqualToString:@"通过"]) {
//        self.examStatus.backgroundColor = [UIColor colorWithRed:242/255.0 green:101.0/255.0 blue:119.0/255.0 alpha:.8];
//    }
//    
//
//  
//}


- (void)awakeFromNib {
    [super awakeFromNib];
    self.leftImageView.layer.borderWidth = 0.5;
    self.leftImageView.layer.borderColor = kBorderColor.CGColor;
    // Initialization code
    self.bgView.layer.borderColor = kBorderColor.CGColor;
    self.bgView.layer.borderWidth =1;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
